<?php
$dis_id=3;
include("../../inc/conn.inc");
include("../islogin2.php");

if($_POST[tj_act]=="sdibcn"){
$check_rs=@mysql_query("select id,m_type from member where id='".$_COOKIE['user_id']."'");
$check_row=@mysql_fetch_array($check_rs);
$rs2=@mysql_query("select count(id) from p_list where member_id='".$_COOKIE['user_id']."'");
$num=@mysql_result($rs2,0);
@mysql_free_result($rs2);
	if($check_row[m_type]==3&&$num>=5){
    
	echo "<script>alert('免费会员只能建立5个分类');location='pro_group.php';</script>";
	}else{

    $rs=@mysql_query("select id from p_list where member_id='".$_COOKIE['user_id']."' and p_cname='$_POST[p_cname]'");
	$row=@mysql_fetch_array($rs);
	if($row['id']){
	 
	 echo "<script>alert('该产品分类已经存在');location='pro_group.php';</script>";
	}else{
	 mysql_query("insert into p_list (member_id,p_cname) values ('".$_COOKIE['user_id']."','$_POST[p_cname]')");
	 
     echo "<script>location='pro_group.php';</script>";
	}
	
	}
}
if($_POST['xg_act']=="sdibcn"){
mysql_query("update p_list set p_cname='$_POST[p_cname]',member_id='".$_COOKIE['user_id']."' where id='".$_POST['iid']."'");

echo "<script>location='pro_group.php';</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 供应信息 &gt;&gt; 产品管理</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">添加产品分类</TD>
   </TR>
</TABLE>
<br>
<?php
	if($_GET[tj]){
	?>
      <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C1DCF5">
	  <form method="post" action="" onSubmit="return check()">
        <tr>
          <td height="35" colspan="2" align="center" bgcolor="#EFF6FF">添加新产品分类</td>
        </tr>
        <tr>
          <td width="24%" height="35" align="center" bgcolor="#EFF6FF">产品分类名称</td>
          <td width="76%" bgcolor="#FFFFFF"><input name="p_cname" id="p_cname" type="text" size="30" maxlength="12">
          &nbsp;<font color="#999999">（一个词组最佳）限制12个汉字</font></td>
        </tr>
        <tr>
          <td height="35" align="center" bgcolor="#EFF6FF">&nbsp;</td>
          <td bgcolor="#FFFFFF"><input type="submit" value="提交"></td>
        </tr><input type="hidden" name="tj_act" value="sdibcn">
		</form>
    </table><?php }?>
	<?php
	if($_GET['xg']){
	$rs=mysql_query("select * from p_list where id='".$_GET['xg_id']."' and member_id='".$_COOKIE['user_id']."'");
	$row=mysql_fetch_array($rs);
	?>
      <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C1DCF5">
	  <form method="post" action="">
        <tr>
          <td height="35" colspan="2" align="center" bgcolor="#EFF6FF">修改产品分类</td>
        </tr>
        <tr>
          <td width="24%" height="35" align="center" bgcolor="#EFF6FF">产品分类名称</td>
          <td width="76%" bgcolor="#FFFFFF"><input name="p_cname" id="p_cname" type="text" size="30" value="<?=$row[p_cname]?>" maxlength="12">
          &nbsp;<font color="#999999">（一个词组最佳）限制12个汉字</font></td>
        </tr>
        <tr><input type="hidden" name="iid" value="<?=$row['id']?>">
          <td height="35" align="center" bgcolor="#EFF6FF">&nbsp;</td>
          <td bgcolor="#FFFFFF"><input type="submit" value="提交"></td>
        </tr><input type="hidden" name="xg_act" value="sdibcn">
		</form>
    </table><?php }?><br>
<font color="#CC0000">注意：近期对会员产品分类进行处理，发布时请按照我们的要求添加产品分类（限制一个词组），否则我们直接清理您的账号，并且加入黑名单，您的企业将无法在我们的系统里注册。</font>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");
?>
</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function check(){
if($("p_cname").value==""){
alert("产品分类名称不能为空");
$("p_cname").focus();
return false
}
}
</script>